package com.cwits.wifi.ui.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.cwits.wifi.R;
import com.cwits.wifi.base.BaseFragment;
import com.cwits.wifi.ui.activity.HelpActivity;
import com.cwits.wifi.ui.activity.MainActivity;
import com.cwits.wifi.ui.activity.SettingActivity;
import com.cwits.wifi.ui.activity.StorageMgrActivity;
import com.cwits.wifi.ui.activity.VersionActivity;

/**
 * Created by Administrator on 2016/2/26.
 */
public class RightFragment extends BaseFragment implements View.OnClickListener{
    private View mView;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState)
    {
        mView = inflater.inflate(R.layout.fragment_right, container, false);
        initView();
        return mView;
    }

    private void initView() {
        ((RelativeLayout)(mView.findViewById(R.id.rl_version))).setOnClickListener(this);
        ((RelativeLayout)(mView.findViewById(R.id.rl_storage))).setOnClickListener(this);
        ((RelativeLayout)(mView.findViewById(R.id.rl_help))).setOnClickListener(this);
        ((RelativeLayout)(mView.findViewById(R.id.rl_setting))).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch(v.getId())
        {
            case R.id.rl_version:
                MainActivity lma1 = (MainActivity)this.getActivity();
                if(lma1.getIsCanGo() == false)
                {
                    showToast(getString(R.string.left_wait));
                    return;
                }
                this.getActivity().startActivity(new Intent(this.getActivity(),VersionActivity.class));
                break;
            case R.id.rl_storage:
                MainActivity lma2 = (MainActivity)this.getActivity();
                if(lma2.getIsCanGo() == false)
                {
                    showToast(getString(R.string.left_wait));
                    return;
                }
                this.getActivity().startActivity(new Intent(this.getActivity(),StorageMgrActivity.class));
                break;
            case R.id.rl_help:
                MainActivity lma3 = (MainActivity)this.getActivity();
                if(lma3.getIsCanGo() == false)
                {
                    showToast(getString(R.string.left_wait));
                    return;
                }
                this.getActivity().startActivity(new Intent(this.getActivity(),HelpActivity.class));
                break;
            case R.id.rl_setting:
                MainActivity lma4 = (MainActivity)this.getActivity();
                if(lma4.getIsCanGo() == false)
                {
                    showToast(getString(R.string.left_wait));
                    return;
                }
                this.getActivity().startActivity(new Intent(this.getActivity(),SettingActivity.class));
                break;
        }

    }
}
